package com.qst.itoffer.controller;

import com.qst.itoffer.entity.JobApplyInfo;
import com.qst.itoffer.service.JobApplyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@Slf4j
@Controller
@RequestMapping()
public class JobApplyController {
    @Autowired
    private JobApplyService jobApplyService;

    @GetMapping("/jobApplyList")
    public String getJobApplyList(Model model) {
        List<JobApplyInfo> jobApplyList = jobApplyService.getJobApplyList();
        model.addAttribute("jobApplyList", jobApplyList);
        log.info("全体jobApplyList: " + jobApplyList);
        return "manage/jobApplyList";
    }
    // 删除无效职位
    @GetMapping("/deleteInvalidJobs")
    public String deleteInvalidJobs(Model model) {
        jobApplyService.deleteInvalidJobs();
        model.addAttribute("message", "无效职位已删除");
        return "manage/result";
    }
}
